UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f9uABIqrmiZgkV7umM2Q+IiCZWP246YSoigWLQhBCK8='
WHERE
key_id = 'cbc0352a2b14d600ed075b376090bb7c19a9edd7b08a8127a12185bea10fa343'
AND (
token = 'f9uABIqrmiZgkV7umM2Q+IiCZWP246YSoigWLQhBCK8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)