UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JqUIFYwr11BbnhzxGtHxfOMWFnv2O+JWBycFKd02m3k='
WHERE
key_id = '7cc808de3a0fecfa29193eb0786d08726a35455b38f69d0ca9ba8e2a7d99ef70'
AND (
token = 'JqUIFYwr11BbnhzxGtHxfOMWFnv2O+JWBycFKd02m3k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)