UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QH+zsYT171rfZwAlBmIwBveOcVzIlDVImwy3xpsLU+8='
WHERE
key_id = 'fe06ae0f81027c9db2b323b7f760776334800c1022f3e27f88061e8c1df67a6d'
AND (
token = 'QH+zsYT171rfZwAlBmIwBveOcVzIlDVImwy3xpsLU+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)