UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XjJDo4E3AKAaCZ6UDLe9Ii2ry3BQRAAgvbIWYolZaEY='
WHERE
key_id = '327b55d904a618232bf0d7470f6553666331ad4d7c3e9bf310b6a834328c007d'
AND (
token = 'XjJDo4E3AKAaCZ6UDLe9Ii2ry3BQRAAgvbIWYolZaEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)