UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+vWS3XO1Wt3Oxlck8HWz7e2ejjSpyJz9Z+0MxGFPbSk=' 
WHERE 
  key_id = '57865d1d41f526cd136aef245a60663114d7b64ced2cf81d1036e0383511170c' 
  AND (
    token = '+vWS3XO1Wt3Oxlck8HWz7e2ejjSpyJz9Z+0MxGFPbSk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031