UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'reBvk03a8mA+JfrG6fA9q3A4UFwr0VRoCY9h/afsY0Q=' 
WHERE 
  key_id = '6400d40221bce0601ecf8cae9f331e940cb20977c982d4d5f649db0e6f409986' 
  AND (
    token = 'reBvk03a8mA+JfrG6fA9q3A4UFwr0VRoCY9h/afsY0Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048