UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lD5Ccam54eiSg3HuL5FwsgD486K9PfuVSCkR1O5mMs4='
WHERE
key_id = '38c95a720ff607dee31e7e1e61dd0e42d8b38b627017135e26a5309028cff5f3'
AND (
token = 'lD5Ccam54eiSg3HuL5FwsgD486K9PfuVSCkR1O5mMs4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)