UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8hIHFwHGtr0KD1Szw86T/cQnYu3AvyJCkKs8U4ncy30='
WHERE
key_id = '40d087d3031e52dd52cdd46204a2c05fda9a5f8d767c6c5211d2434462fcf8d9'
AND (
token = '8hIHFwHGtr0KD1Szw86T/cQnYu3AvyJCkKs8U4ncy30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)