UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hWJpgNVeODj6/Dy6xN/cM5sZojpOi+yW1AQDkU0zHMM='
WHERE
key_id = 'bd3997f7ffe992094e4a14a958876c1529c1a7fb751ec79a58ec52ca6bf89fc7'
AND (
token = 'hWJpgNVeODj6/Dy6xN/cM5sZojpOi+yW1AQDkU0zHMM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)