UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+jMgMCB8MxoL3xyE/WmhrwYtd7kOV1UX0RBQG3uVjo=' 
WHERE 
  key_id = '2c741ad4ff4611069672f9e97a44a97464fb62460a00a547a0833c7b53ae82a7' 
  AND (
    token = 'B+jMgMCB8MxoL3xyE/WmhrwYtd7kOV1UX0RBQG3uVjo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038