UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3EhNBbpA6t9RmuBgsFYMkQHlTs0uaWDx8S9CmNGMcR4=' 
WHERE 
  key_id = '745253882ec1338c56aadecf8aaf10ce2c891453a72f6aad55465b12d087b7d4' 
  AND (
    token = '3EhNBbpA6t9RmuBgsFYMkQHlTs0uaWDx8S9CmNGMcR4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027