UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2dzT9+1wUQjwk1XPSVd/pWZ//d8yjaxBwUz6r97aZj8='
WHERE
key_id = 'e5d23518437d8d8487c843b2a82bac32b3a40bf17abfd57489ff3b3083b73a33'
AND (
token = '2dzT9+1wUQjwk1XPSVd/pWZ//d8yjaxBwUz6r97aZj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)