UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oGy3lx7tBPKriMm+4EmvNcigDN9AdBsd+qpizQpeluU='
WHERE
key_id = 'ff8ef3d836a2b46cd48c35e3271927f4873c82b40a19c68472a6f77134570222'
AND (
token = 'oGy3lx7tBPKriMm+4EmvNcigDN9AdBsd+qpizQpeluU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)