UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2R2GtvNGAHpkOQxbujbc+PIqNRzD+xpK7IjdERjmAMw='
WHERE
key_id = 'bf19944456f060aa1274265da4921e9541ac4ddb31f2f667bcc94d2dc386db8c'
AND (
token = '2R2GtvNGAHpkOQxbujbc+PIqNRzD+xpK7IjdERjmAMw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)