UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KlqU+2T0wfhnv9PXhrW1yPZaGtuogjF5dPsksn1M26I='
WHERE
key_id = 'ce48757d7cf3ab0f2970443515a3490823b3843cc749b031fe945b7a71e02c2d'
AND (
token = 'KlqU+2T0wfhnv9PXhrW1yPZaGtuogjF5dPsksn1M26I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)