UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6J7tN9vE6EFtV2lXnGHz9aPWuuYj07C8I0HykHkSzXs='
WHERE
key_id = '88edb97b60fb4025fe2fb66e46654a3890fb5ef31cc4deae115b8d245e25aad3'
AND (
token = '6J7tN9vE6EFtV2lXnGHz9aPWuuYj07C8I0HykHkSzXs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)