UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E8WBxb/sXmrKQCovO29rhhaNcamN3AGJH6WpHgjkVgE='
WHERE
key_id = 'bf025ba80ee1ebb3212e50eeb235c5882e4ac39ea9a30f5d9a5d2c89dd3ef6e1'
AND (
token = 'E8WBxb/sXmrKQCovO29rhhaNcamN3AGJH6WpHgjkVgE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)