UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mQw8nnbCK9OGflCar90nV6iGUrAEhdI0a5Sh3x8UAUI='
WHERE
key_id = '1a22ea2651bb592f7d9ac12ddbc40d624b5882e89db6c6660df0cd92ce41b0ce'
AND (
token = 'mQw8nnbCK9OGflCar90nV6iGUrAEhdI0a5Sh3x8UAUI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)