UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r4BMig2YqAaztX125OK+Iry+1o1AjkymosI7AsGT05U='
WHERE
key_id = '5052e8326b7e47064052a371ee8eb543e1c2b39204560865e84efc8507dcce25'
AND (
token = 'r4BMig2YqAaztX125OK+Iry+1o1AjkymosI7AsGT05U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)