UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yakBmkfeW5yT2OQYcjC01dpcxM8McpXLgU/VhWnxxFo=' 
WHERE 
  key_id = '5b1d8c254d06b61d82d962c7eb782101f235cef4275da41ee6fda21788ac7528' 
  AND (
    token = 'yakBmkfeW5yT2OQYcjC01dpcxM8McpXLgU/VhWnxxFo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024