UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xnDBTgvE0NotViTGiP5aVNxaNlDBM5vt0YZ10nDA+B4='
WHERE
key_id = '3f0214ea70f96104e008eb85f9e78526ebe731e5387ea05ab57531d9cbecd09f'
AND (
token = 'xnDBTgvE0NotViTGiP5aVNxaNlDBM5vt0YZ10nDA+B4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)