UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T1Pds5KJ1/9dhoMv+xY6I59vkgtjHYisNAj4CeebyUU=' 
WHERE 
  key_id = 'fcde33f2404440500aa8e7a2c89a860b443b2b0761d9b4ffb87ebc7683cdefc8' 
  AND (
    token = 'T1Pds5KJ1/9dhoMv+xY6I59vkgtjHYisNAj4CeebyUU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025