UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'taXK/uLXZiyUd4Q8W17d4aKLsAHONe7/m81BvIsIpWE='
WHERE
key_id = 'c31e57c5419ec81f3a06dcfd4a37b445822fbccc61614c736a85358333c2c22f'
AND (
token = 'taXK/uLXZiyUd4Q8W17d4aKLsAHONe7/m81BvIsIpWE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)