UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NyCCCJurMiURgmA1FrkcRYxwqsQBJ9QoqQW71HdDh1U='
WHERE
key_id = 'ad4d5f0006ea3d0c78a25e415da75a00ad620e20265ecd57e5435df4221dc7c2'
AND (
token = 'NyCCCJurMiURgmA1FrkcRYxwqsQBJ9QoqQW71HdDh1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)