UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9dth5SkiSLtb3gpn7subrJc9QTRyh2bu6YsDHjnjRmk='
WHERE
key_id = '240bd4597c873c3c68589cf8d1d216197b3334f1281b22bbfd9d6f61ad9ec5f9'
AND (
token = '9dth5SkiSLtb3gpn7subrJc9QTRyh2bu6YsDHjnjRmk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)