UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WLQxkXVl2GWEP0zjE16NoIOX4CPcIXQ5UU9FJYVRh4U='
WHERE
key_id = '8ec4b5dab0d18f6effc19f0114567a719c231572b09c82614af4e4146cab65f0'
AND (
token = 'WLQxkXVl2GWEP0zjE16NoIOX4CPcIXQ5UU9FJYVRh4U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)