UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xmYoO0I3fyfNCS259edqpY0N8iXBSte5+PYS2LdcQ+8=' 
WHERE 
  key_id = '81067378cb3b652a93382be1a1a354d0b017d26870e1351901df5374ca97a393' 
  AND (
    token = 'xmYoO0I3fyfNCS259edqpY0N8iXBSte5+PYS2LdcQ+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036