UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5QwuHyiCV1ZF30e7OtE3o04ToSX4oulDg+rnJS742Kg=' 
WHERE 
  key_id = 'dc906133df351c1aad65d28679a485a31b642b207943a60bfa84294c1a730ab5' 
  AND (
    token = '5QwuHyiCV1ZF30e7OtE3o04ToSX4oulDg+rnJS742Kg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022