UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'auLdwzC8VawNGuNN/SrlCU58NGg55nQh3qVXkLCf2v0='
WHERE
key_id = 'a9d6042d7557dfe083619e11b0b79b53e5c35abdee3b5240541a0651fa727e02'
AND (
token = 'auLdwzC8VawNGuNN/SrlCU58NGg55nQh3qVXkLCf2v0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)