UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dJ+uhQsOVhwejN8RRqzckvIxTmIWRSACVyLqVaLeVNc='
WHERE
key_id = 'b2d897a88ee5f7063a997892aa9ec793240464302e37c9a8a674b499778f29a8'
AND (
token = 'dJ+uhQsOVhwejN8RRqzckvIxTmIWRSACVyLqVaLeVNc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)