UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2I7RMfpKaKQeC2y4eMZCCnKYLWVfmEbm6Ua5olBALEs='
WHERE
key_id = '05823fb4f5100054620c0479514f60554faa075f3374aa9bec6e00d8511e12a6'
AND (
token = '2I7RMfpKaKQeC2y4eMZCCnKYLWVfmEbm6Ua5olBALEs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)