UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M6D+FBA9MImQbso7/kFWPmd/2bWNtHOvDC/5eA6tmDU='
WHERE
key_id = 'bd6f94b44465f972719850fdd85cfb80590924701a23fa96123bfc33a69755ff'
AND (
token = 'M6D+FBA9MImQbso7/kFWPmd/2bWNtHOvDC/5eA6tmDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)