UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4O3CKZ7hAG0GkBoMO7f9bYtikDGJEDxeCbtOxm8S5+4=' 
WHERE 
  key_id = '8463efbd19885fd7756667af794b3c8ba3786dfee95d9917adce74964d54f58d' 
  AND (
    token = '4O3CKZ7hAG0GkBoMO7f9bYtikDGJEDxeCbtOxm8S5+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033