UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sKEM2MpfwuJUVudLLsZiTNVfeOpOAHX3mrEOyFJlZVk='
WHERE
key_id = '0f76e96f6d25976d6aa835a67e5a2a91a2618c35ea03fd017b684d0a98c2fc11'
AND (
token = 'sKEM2MpfwuJUVudLLsZiTNVfeOpOAHX3mrEOyFJlZVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)