UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A39TWYDB7Vt/xoVZl2moapd/of0pBqwCPD6gDDyTBE0='
WHERE
key_id = '69a82561881ee35657306726c14afeeae9bad336de045be0f2cca3a44a0fdef3'
AND (
token = 'A39TWYDB7Vt/xoVZl2moapd/of0pBqwCPD6gDDyTBE0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)