UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cjMVfehyGbE5TYNBVoSuq3hze4d219uS+jcY8ibWzmI=' 
WHERE 
  key_id = '48a23c121bdf32cfd90c0146181286337d28cfda5bb78a2428b0edfb8c067128' 
  AND (
    token = 'cjMVfehyGbE5TYNBVoSuq3hze4d219uS+jcY8ibWzmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044