UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tm5lyjhWNFiM/KL5UfcLkmRAsHu/MvrmLQn7X81XOVU='
WHERE
key_id = 'e4058bfe6579d7d6f699941ae1378b8b68a2acb014ac50c92d2d021c28d3fbb4'
AND (
token = 'tm5lyjhWNFiM/KL5UfcLkmRAsHu/MvrmLQn7X81XOVU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)