UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r0vBktihhNLt6o9xfuIDfjciQIt7Cy7X/BSSpKaLj3s='
WHERE
key_id = '329efd87bbdc23617373b253c414db35a5673d88398437bc40a45241589742df'
AND (
token = 'r0vBktihhNLt6o9xfuIDfjciQIt7Cy7X/BSSpKaLj3s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)