UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sRyO1gNutNbXCk4WQihsHA65pzNioWTJd1+uqrCx5kc='
WHERE
key_id = '9d5ed8f40159a186db09edd0dcbf58a9e27e9042bd8896df30147a43d6c5b8b9'
AND (
token = 'sRyO1gNutNbXCk4WQihsHA65pzNioWTJd1+uqrCx5kc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)