UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MIHtMBFxJhHxeaBmcF8x47mAT+eSubT7lU0xfDyh6r0='
WHERE
key_id = 'b994f11164d85b848576d10ae5993fe295d777053c5d12bb0bf8faada1f3c167'
AND (
token = 'MIHtMBFxJhHxeaBmcF8x47mAT+eSubT7lU0xfDyh6r0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)