UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NWsdIjCw/7xqCS9bzDyTixEp1nMkNBklcp9jw6UGZDg='
WHERE
key_id = '34af36ceeaf95cd6a046eadbe82bf1029581facbd82b721f01c973740a4e8cc1'
AND (
token = 'NWsdIjCw/7xqCS9bzDyTixEp1nMkNBklcp9jw6UGZDg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)